package br.com.felix.easyclearcase.ui.dialogs;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;

import javax.swing.JFrame;

import br.com.felix.easyclearcase.Comment;
import br.com.felix.easyclearcase.EasyClearCaseFile;

/**
 * Dialog used to ask the user's comment about a file being checked in.
 * @see AbstractCommentDialog
 * */
public class CheckinDialog extends AbstractCommentDialog {

	private static final long serialVersionUID = 1856899134522166925L;
	
	
	/**
	 * @see AbstractCommentDialog#AbstractCommentDialog(JFrame, File, Comment)
	 * */
	public CheckinDialog(JFrame parent, EasyClearCaseFile file, final Comment commonComment) {
		super(parent, file, commonComment);
	
		MouseAdapter commonCommentMouseAdapter = new MouseAdapter(){
			public void mouseReleased(MouseEvent e) {
				commonComment.setApplyToAll(chkApplyToAll.isSelected());
				if(chkApplyToAll.isSelected()){
					commonComment.setComment(txtaComment.getText());
				}	
			}
		};
		addCommitMouseListener(commonCommentMouseAdapter);
		addSkipMouseListener(commonCommentMouseAdapter);
		
	}



	/**
	 * @see AbstractCommentDialog#getOperationConfirmationTitle()
	 * */
	@Override
	protected String getOperationConfirmationTitle() {
		return "Do you confirm this file's checkin?";
	}
	
	
}
